
//https://leetcode.cn/problems/container-with-most-water/description/

class Solution {
public:
    int maxArea(vector<int>& height) {

        int ret = 0;
        int left = 0, right = height.size() - 1;
        while (left < right) {
            int value = (right - left) * min(height[left], height[right]);
            if (ret < value)
                ret = value;

            if (height[left] < height[right])
                left++;
            else
                right--;
        }

        return ret;
    }
};
